package cn.yzfy.common.validate;

import cn.yzfy.common.validate.impl.NotNullAndEmptyValidatorImpl;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import cn.yzfy.common.validate.impl.NotChineseValidatorImpl;

import java.lang.annotation.*;

/**
 * 验证不能出现中文,不能出现中文
 */
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(
    validatedBy = {NotChineseValidatorImpl.class}
)
public @interface ValidateNotChinese {
  String message() default "不允许出现中文";
  
  /**
   * 验证参数是否为必须的
   */
  boolean required() default true;
  
  Class<?>[] groups() default {};
  
  Class<? extends Payload>[] payload() default {};

  /**
   * 验证不能为空或者null
   */
  @Target({ElementType.FIELD})
  @Retention(RetentionPolicy.RUNTIME)
  @Documented
  @Constraint(
      validatedBy = {NotNullAndEmptyValidatorImpl.class}
  )
  @interface ValidateNotNullAndEmpty {

    String message() default "不可为Null或空";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
  }
}